<?php
class excution extends CI_Controller  {

        /* 
            Project     : 48c6c450f1a4a0cc53d9585dc0fee742
            Created on  : Mar 16, 2013, 11:29:15 PM
            Author      : Truong Khuong - khuongxuantruong@gmail.com
            Description :
                Purpose of the stylesheet follows.
        */
        function __construct(){
            parent::__construct();
            $this->smarty=new CI_Smarty3();
            $this->smarty->error_reporting = E_ALL & ~E_NOTICE;
        }
        function getalias(){
            $text=$this->input->post("text");
            $result=1;
            $message=convertUrl($text);
            echo json_encode(array(
                "result"=>$result,
                "message"=>$message,
                "alias"=>$message
            ));
        }
        function index(){
            echo "index";
        }
        function choosealbum(){
            $assigns=null;
            $this->smarty
                ->assign($assigns)
                ->display("plugin/01_choosealbum");
        }
        function update_backend($func='',$table='',$prefix='null',$id=''){
            $R["result"] = -1;
            $R["message"] = ascii_to_entities("This function to requires an administrative account.<br/>Please check your authority, and try again.");
            $this->load->model('backend/base_model');
            if($prefix=='null')$prefix='';
            $model=new base_model($table,$prefix);
            $params=$this->input->post();
            unset($params['ajaxtype']);
            $rs=$model->_update($id,$params);
            if ($rs === true) {
                $R["result"] = 1;
                $R["message"] = ascii_to_entities("Success. Record have been updated.");
            } else {
                $R["result"] = -1;
                $R["error_number"] = $this->db->_error_number();
                $R["error_message"] = $this->db->_error_message();
                $R["message"] = ascii_to_entities("
                        Fail. Please check data input and try again.<br/>
                        ");
                if ($R["error_number"] != 0)
                    $R["message"].=ascii_to_entities("<span class='erc'>[" . $R["error_number"] . "] " . $R["error_message"] . ".</span>");
            }
            echo json_encode($R);
        }
}
?>
